#include #include using namespace std; #pragma warning( disable : 996 ) //strlen //strcpy(destination,source) //strncpy - copies the frist n chars from the source to the destination, // does not place the '\0' every time //strcmp(s1,s2) - return 0, 1, -1 - case sensitive //stricmp - same as strcmp but case insensitive //strncmp - same as strcmp but only compares the first n chars //strnicmp - stricmp and strncmp //strcat //strncat //strchr - returns the address of where it finds the char, // NULL if it dose not find it before the '\0' //strstr - returns the addres of where it finds a string in a string //NULL is the address 0 //toupper //tolower //concatenate //hot //dog void concatenateString(char destination[], const char source[]) { int resultLength = (int)(strlen(destination) + strlen(source)); int destinationLength = (int)strlen(destination); for( int i = destinationLength; i < resultLength; i++) { destination[i] = source[i - destinationLength]; destination[i + 1] = '\0'; } } void main() { char s1[1000] = "This is FridayZis is is is "; char s2[100] = "is"; //strncpy(s1, s2, 7); //concatenateString(s1,s2); //strncat(s1,s2,5); //this is a test //cout << (int)s1 << endl; //cout << (int)(strchr(s1,'Z') - s1) << endl; //if(strchr(s1,'Z') != NULL) //{ // cout << "There is a Z in that string" << endl; //} //if(strstr(s1,s2) != NULL) //{ // cout << "Yes, it is in there" << endl; // cout << (int)(strstr(s1,s2) -s1) << endl; //} char* p = strstr(s1,s2); int count = 0; while(p != NULL) { count++; p = strstr(p+1,s2); } cout << count << endl; }